package com.certapp.dao.mapper;

import com.certapp.dao.entity.TbQueryResultPage;
import com.certapp.dao.entity.TbQueryResultPageExample;
import java.util.List;
import java.util.Optional;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface TbQueryResultPageMapper {

    @Select({ "select", "id, cert_config_id, title, enable_fields, bottom_log, explain_doc", "from tb_query_result_page", "where cert_config_id = #{certConfigId,jdbcType=INTEGER}" })
    @Results({ @Result(column = "id", property = "id", jdbcType = JdbcType.INTEGER, id = true), @Result(column = "cert_config_id", property = "certConfigId", jdbcType = JdbcType.INTEGER), @Result(column = "title", property = "title", jdbcType = JdbcType.VARCHAR), @Result(column = "fields", property = "fields", jdbcType = JdbcType.VARCHAR), @Result(column = "bottom_log", property = "bottomLog", jdbcType = JdbcType.VARCHAR), @Result(column = "explain_doc", property = "explainDoc", jdbcType = JdbcType.VARCHAR) })
    TbQueryResultPage selectByCertConfigId(@Param("certConfigId") Integer certConfigId);

    @Update({ "update tb_query_result_page", "set title = #{title,jdbcType=VARCHAR},", "enable_fields = #{enableFields,jdbcType=VARCHAR},", "bottom_log = #{bottomLog,jdbcType=VARCHAR},", "explain_doc = #{explainDoc,jdbcType=VARCHAR}", "where cert_config_id = #{certConfigId,jdbcType=INTEGER}" })
    int updateByCertConfigId(TbQueryResultPage record);

    @Delete({ "delete from tb_query_result_page", "where cert_config_id = #{certConfigId,jdbcType=INTEGER}" })
    int deleteByCertConfigId(@Param("certConfigId") Integer certConfigId);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_query_result_page
     *
     * @mbg.generated
     */
    @SelectProvider(type = TbQueryResultPageSqlProvider.class, method = "countByExample")
    long countByExample(TbQueryResultPageExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_query_result_page
     *
     * @mbg.generated
     */
    @DeleteProvider(type = TbQueryResultPageSqlProvider.class, method = "deleteByExample")
    int deleteByExample(TbQueryResultPageExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_query_result_page
     *
     * @mbg.generated
     */
    @Delete({ "delete from tb_query_result_page", "where id = #{id,jdbcType=INTEGER}" })
    int deleteByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_query_result_page
     *
     * @mbg.generated
     */
    @Insert({ "insert into tb_query_result_page (cert_config_id, title, ", "enable_fields, explain_doc, ", "bottom_log)", "values (#{certConfigId,jdbcType=INTEGER}, #{title,jdbcType=VARCHAR}, ", "#{enableFields,jdbcType=VARCHAR}, #{explainDoc,jdbcType=VARCHAR}, ", "#{bottomLog,jdbcType=LONGVARCHAR})" })
    @SelectKey(statement = "SELECT LAST_INSERT_ID()", keyProperty = "id", before = false, resultType = Integer.class)
    int insert(TbQueryResultPage record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_query_result_page
     *
     * @mbg.generated
     */
    @InsertProvider(type = TbQueryResultPageSqlProvider.class, method = "insertSelective")
    @SelectKey(statement = "SELECT LAST_INSERT_ID()", keyProperty = "id", before = false, resultType = Integer.class)
    int insertSelective(TbQueryResultPage record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_query_result_page
     *
     * @mbg.generated
     */
    @SelectProvider(type = TbQueryResultPageSqlProvider.class, method = "selectByExampleWithBLOBs")
    @Results({ @Result(column = "id", property = "id", jdbcType = JdbcType.INTEGER, id = true), @Result(column = "cert_config_id", property = "certConfigId", jdbcType = JdbcType.INTEGER), @Result(column = "title", property = "title", jdbcType = JdbcType.VARCHAR), @Result(column = "enable_fields", property = "enableFields", jdbcType = JdbcType.VARCHAR), @Result(column = "explain_doc", property = "explainDoc", jdbcType = JdbcType.VARCHAR), @Result(column = "bottom_log", property = "bottomLog", jdbcType = JdbcType.LONGVARCHAR) })
    List<TbQueryResultPage> selectByExampleWithBLOBs(TbQueryResultPageExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_query_result_page
     *
     * @mbg.generated
     */
    @SelectProvider(type = TbQueryResultPageSqlProvider.class, method = "selectByExample")
    @Results({ @Result(column = "id", property = "id", jdbcType = JdbcType.INTEGER, id = true), @Result(column = "cert_config_id", property = "certConfigId", jdbcType = JdbcType.INTEGER), @Result(column = "title", property = "title", jdbcType = JdbcType.VARCHAR), @Result(column = "enable_fields", property = "enableFields", jdbcType = JdbcType.VARCHAR), @Result(column = "explain_doc", property = "explainDoc", jdbcType = JdbcType.VARCHAR) })
    List<TbQueryResultPage> selectByExample(TbQueryResultPageExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_query_result_page
     *
     * @mbg.generated
     */
    @Select({ "select", "id, cert_config_id, title, enable_fields, explain_doc, bottom_log", "from tb_query_result_page", "where id = #{id,jdbcType=INTEGER}" })
    @Results({ @Result(column = "id", property = "id", jdbcType = JdbcType.INTEGER, id = true), @Result(column = "cert_config_id", property = "certConfigId", jdbcType = JdbcType.INTEGER), @Result(column = "title", property = "title", jdbcType = JdbcType.VARCHAR), @Result(column = "enable_fields", property = "enableFields", jdbcType = JdbcType.VARCHAR), @Result(column = "explain_doc", property = "explainDoc", jdbcType = JdbcType.VARCHAR), @Result(column = "bottom_log", property = "bottomLog", jdbcType = JdbcType.LONGVARCHAR) })
    TbQueryResultPage selectByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_query_result_page
     *
     * @mbg.generated
     */
    @UpdateProvider(type = TbQueryResultPageSqlProvider.class, method = "updateByExampleSelective")
    int updateByExampleSelective(@Param("record") TbQueryResultPage record, @Param("example") TbQueryResultPageExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_query_result_page
     *
     * @mbg.generated
     */
    @UpdateProvider(type = TbQueryResultPageSqlProvider.class, method = "updateByExampleWithBLOBs")
    int updateByExampleWithBLOBs(@Param("record") TbQueryResultPage record, @Param("example") TbQueryResultPageExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_query_result_page
     *
     * @mbg.generated
     */
    @UpdateProvider(type = TbQueryResultPageSqlProvider.class, method = "updateByExample")
    int updateByExample(@Param("record") TbQueryResultPage record, @Param("example") TbQueryResultPageExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_query_result_page
     *
     * @mbg.generated
     */
    @UpdateProvider(type = TbQueryResultPageSqlProvider.class, method = "updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(TbQueryResultPage record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_query_result_page
     *
     * @mbg.generated
     */
    @Update({ "update tb_query_result_page", "set cert_config_id = #{certConfigId,jdbcType=INTEGER},", "title = #{title,jdbcType=VARCHAR},", "enable_fields = #{enableFields,jdbcType=VARCHAR},", "explain_doc = #{explainDoc,jdbcType=VARCHAR},", "bottom_log = #{bottomLog,jdbcType=LONGVARCHAR}", "where id = #{id,jdbcType=INTEGER}" })
    int updateByPrimaryKeyWithBLOBs(TbQueryResultPage record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_query_result_page
     *
     * @mbg.generated
     */
    @Update({ "update tb_query_result_page", "set cert_config_id = #{certConfigId,jdbcType=INTEGER},", "title = #{title,jdbcType=VARCHAR},", "enable_fields = #{enableFields,jdbcType=VARCHAR},", "explain_doc = #{explainDoc,jdbcType=VARCHAR}", "where id = #{id,jdbcType=INTEGER}" })
    int updateByPrimaryKey(TbQueryResultPage record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_query_result_page
     *
     * @mbg.generated
     */
    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
    @Insert({ "<script>", "insert into tb_query_result_page (cert_config_id, ", "title, enable_fields, ", "explain_doc, bottom_log)", "values<foreach collection=\"list\" item=\"detail\" index=\"index\" separator=\",\">(#{detail.certConfigId,jdbcType=INTEGER}, ", "#{detail.title,jdbcType=VARCHAR}, #{detail.enableFields,jdbcType=VARCHAR}, ", "#{detail.explainDoc,jdbcType=VARCHAR}, #{detail.bottomLog,jdbcType=LONGVARCHAR})</foreach></script>" })
    int batchInsert(List<TbQueryResultPage> list);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_query_result_page
     *
     * @mbg.generated
     */
    @SelectProvider(type = TbQueryResultPageSqlProvider.class, method = "getOneByExample")
    @Results({ @Result(column = "id", property = "id", jdbcType = JdbcType.INTEGER, id = true), @Result(column = "cert_config_id", property = "certConfigId", jdbcType = JdbcType.INTEGER), @Result(column = "title", property = "title", jdbcType = JdbcType.VARCHAR), @Result(column = "enable_fields", property = "enableFields", jdbcType = JdbcType.VARCHAR), @Result(column = "explain_doc", property = "explainDoc", jdbcType = JdbcType.VARCHAR), @Result(column = "bottom_log", property = "bottomLog", jdbcType = JdbcType.LONGVARCHAR) })
    Optional<TbQueryResultPage> getOneByExample(TbQueryResultPageExample example);
}
